<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/comm :: head " ></head>
<body>
<div class="wrapper">
	<header th:replace="common/comm :: header "></header>
	<div class="main-panel">
		<div class="content">
			<div class="container-fluid">
				<h4 class="page-title">
					<font id="WOW_TRANSLATE_43" class="WOW_TRANSLATE_STYLE" th:if="${attr == 'reg' }"
						  data--w-o-w_-i-n-d-e-x="43">招聘管理 > 职位发布登记</font>
					<font id="WOW_TRANSLATE_43" class="WOW_TRANSLATE_STYLE" th:if="${attr == 'upd' }"
						  data--w-o-w_-i-n-d-e-x="43">招聘管理 > 职位发布变更</font>
				</h4>
				<div class="row">
					<div class="col-md-12">
						<div class="card">

							<div class="card-body">
								<form class="form-inline" th:action="@{'/sys/recruit/'+${attr}+'Save'}"  method="post" >

									<div class="form-group">
										<label for="code"><font> 部门:&nbsp;&nbsp; </font></label>
										<input type="hidden" name="oId" th:value="${organ.id}">
										<input id="oName" readonly="readonly" type="text" class="form-control"   th:value="${organ.fullName}" >
										<small  class="form-text text-muted"></small>
									</div>

									<div  class="form-group">
										<label for="testunit"> 招聘类型: &nbsp;&nbsp; </label>
										<select  class="form-control" name="type"  >
											<option th:selected="${rtype.valueId==recruit.type}" th:each="rtype:${rtypes}" th:value="${rtype.valueId}" th:text="${rtype.valueName}" ></option>
										</select>
										<small  class="form-text text-muted"></small>
									</div>

									<div class="form-group">
										<label for="testrange"> 招聘人数:&nbsp;&nbsp; </label>
										<input name="countP" class="form-control" th:value="${recruit.countP}" required="required" oninvalid="setCustomValidity('请填写招聘人数!')" oninput="setCustomValidity('')" />
										<small  class="form-text text-muted"></small>
									</div>

									<div class="form-group">
										<label for="low">职位名称：&nbsp;&nbsp; </label>
										<input type="hidden" name="postId" th:value="${recruit.postId}">
										<input  readonly="readonly" id="pName" class="form-control"  th:value="${post.name}"  />
										<img th:src="@{/images/search.png}" href="javascript:;"
											 data-toggle="modal"
											 data-target=".bs-example-modal-lg"/>
										<small  class="form-text text-muted"></small>
									</div>


									<div class="form-group">
										<label for="low">职位编码：&nbsp;&nbsp; </label>
										<input id="postCode" class="form-control" readonly="readonly"  th:value="${post.code}"  />
										<small  class="form-text text-muted"></small>
									</div>

									<div class="form-group">
										<label for="low">职位分类：&nbsp;&nbsp; </label>
										<input id="postType"   class="form-control"  readonly="readonly" th:value="${postType.valueName}"  />
										<small  class="form-text text-muted"></small>
									</div>

									<div class="form-group">
										<label for="up">登记人: &nbsp;&nbsp; </label>
										<input type="hidden" name="createdById" th:value="${#session.getAttribute('userSession').id}">
										<!--<span th:text="${#session.getAttribute('userSession').id}"></span>-->
										<input    class="form-control" th:value="${#session.getAttribute('userSession').username}" readonly="readonly"  />
										<small  class="form-text text-muted"></small>
									</div>

									<div class="form-group" th:if="${attr == 'reg'}">
										<label for="up">登记时间: &nbsp;&nbsp; </label>
										<input  readonly="readonly"  name="createdDate"   class="form-control" th:value="${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd')}" required="required"   />
										<small  class="form-text text-muted"></small>
									</div>

									<div class="form-group" th:if="${attr == 'upd'}">
										<input type="hidden" name="id" th:value="${recruit.id}">
										<label for="up">登记时间: &nbsp;&nbsp; </label>
										<input readonly="readonly" class="form-control" th:value="${#dates.format(recruit.createdDate, 'yyyy-MM-dd')}"      />
										<small  class="form-text text-muted"></small>
									</div>

									<div class="form-group">
										<label for="up">截至日期: &nbsp;&nbsp; </label>
										<input type="date" name="deadline"  id="deadline"  class="form-control"   required="required"  oninvalid="setCustomValidity('请选择截至日期!')" oninput="setCustomValidity('')" /><!--th:value="${#dates.format(recruit.deadline, 'yyyy-MM-dd')}"-->
										<small  class="form-text text-muted"></small>
									</div>

									<div class="form-group">
										<label for="testrange"> 职位描述:&nbsp;&nbsp; </label>
										<textarea class="form-control" rows="5" cols="105" th:text="${recruit.postDescribe}" name="postDescribe"></textarea>
										<small  class="form-text text-muted"></small>
									</div>

									<div class="form-group">
										<label for="testrange"> 招聘要求:&nbsp;&nbsp; </label>
										<textarea class="form-control" rows="5" cols="105" th:text="${recruit.require}"  name="require"></textarea>
										<small  class="form-text text-muted"></small>
									</div>



									<p>
										<!--<s:property value="message" />-->
									</p>


									<div class="form-group" style="text-align: center;">
										<input type="submit" class="btn btn-success" name="add" id="ausub" value="提交">
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										<input type="button" th:onclick="'javascript:history.go(-1);'" class="btn btn-danger"  value="返回" >
									</div>
								</form>
							</div>
						</div>
					</div>
				</div>

			</div>

			<!-- Modal -->
			<div id="postin" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<span>应聘职位列表</span>
							<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
									aria-hidden="true">&times;</span></button>
						</div>
						<div class="modal-body">
							<input id="oId" type="hidden" th:value="${oId}"/>
							<form class="form-inline" th:action="@{/sys/post/showList(show='incl')}" method="post" id="formIndex2"
								  onsubmit="return false">
								<input type="hidden" id="showDiv" value="showList">
								<input type="hidden" value="1" name="pageIndex" id="formPageNo"/>
								&nbsp;&nbsp;职位名称:&nbsp;&nbsp;
								<input class="form-control " style="width: 130px" type="text" name="name" th:value="${name}"/>
								&nbsp;&nbsp;所属部门:&nbsp;&nbsp;
								<select class="form-control" name="oId">
								</select>
								<input type="hidden" name="isStart" value="1">
								&nbsp;&nbsp; &nbsp;&nbsp;<input type="button" id="sel"
																value="查询" class="btn btn-default"
																onclick="queryList(document.getElementById('formIndex2'),1)">
								&nbsp;&nbsp;
								&nbsp;&nbsp;<input type="button" id="ok" value="确定" class="btn btn-default">
								&nbsp;&nbsp;
							</form>
							<div id="showList" class="pageListShow"></div>
						</div>
					</div>
				</div>
			</div>

		</div>
	</div>
	<footer th:replace="common/comm :: footer "></footer>
</div>
</body>
<script th:src="@{/js_hr/post/post.js}"></script>
<script th:inline="javascript">


	var now =new Date([[${#dates.format(recruit.deadline, 'yyyy-MM-dd')}]]);
    //格式化日，如果小于9，前面补0
    var day = ("0" + now.getDate()).slice(-2);
    //格式化月，如果小于9，前面补0
    var month = ("0" + (now.getMonth() + 1)).slice(-2);
    //拼装完整日期格式
    var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
    //完成赋值
    jQuery(function($){
        $("#deadline").val(today);

        $("#ok").bind("click",function () {
            var post =$("input[name='id']:checked");
            var postId=post.val();
            var postName =post.parents("td").next().next().text();
            var postCode =post.parents("td").next().next().next().text();
            var postType =post.parents("td").next().text();
            var oId =post.parents("td").children(":last").val();
            var oName =post.parents("tr").children(":last").text();
            $("#pName").val(postName);
            $("#pName").prev().val(postId);
            $("#postCode").val(postCode);
            $("#postType").val(postType);
            $("#oName").val(oName);
            $("#oName").prev().val(oId);
            $("#postin").modal('hide');
        });

        queryList($("#formIndex2").get(0), 1);



    });



</script>
</html>